<?php
namespace app\admin\model;

use think\Model;
use think\Request;

class Position extends Model
{
    public static  function getlist(Request $request)
    {
        $genData = $request->get();

        $genData = getOutpageData($genData);
        if (isset($genData['status'])==='') {

            unset($genData['status']);
        }

        if (count($genData)>=2||isset($genData['searchval'])) {
            $fileds = ['title','content','company_mobile', 'company_name', 'region_name','name'];
            $whereData = genWhereOrData($genData,$fileds);
            $model= makeWhereObject((new self()), $whereData);
        } else {

            $model=  (new self())->where($genData);
        }

        $res = $model->order('id','desc')
//            ->fetchSql(true)
//            ->select();

            ->paginate(10, false,[  'var_page' => 'page']);
        return $res;
    }

}
